﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace An_Im.Expression.Model
{
    /// <summary>
    /// 表达式结果
    /// </summary>
    public class ExpressionResult
    {
        public List<double> DataList { get; private set; }
        public bool TimeValid { get; private set; }
        public bool StartValueValid { get; private set; }
        public bool EndValueValid { get; private set; }
        public bool FormulaValid { get; private set; }

        public string StartValueErrorInformation { get; private set; }
        public string EndValueErrorInformation { get; private set; }
        public string FormulaErrorInformation { get; private set; }

        public ExpressionResult(List<double> dataList) : this(dataList, true, true, true, true, string.Empty, string.Empty, string.Empty)
        {

        }

        public ExpressionResult(List<double> dataList, bool timeValid, bool startValueValid, bool endValueValid, bool formulaValid, string startValueErrorInfo, string endValueErrorInfo, string formulaErrorInfo)
        {
            DataList = dataList;
            TimeValid = timeValid;
            StartValueValid = startValueValid;
            EndValueValid = endValueValid;
            FormulaValid = formulaValid;
            StartValueErrorInformation = startValueErrorInfo;
            EndValueErrorInformation = endValueErrorInfo;
            FormulaErrorInformation = formulaErrorInfo;
        }

        public bool IsValid()
        {
            return DataList != null && TimeValid && StartValueValid && EndValueValid && FormulaValid;
        }

    }
}
